﻿<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
    xmlns:local="clr-namespace:WebsiteLoadTool.Configuration"
    x:Class="WebsiteLoadTool.Configuration.ConfigurationWindowView"
    Title="Configuration Window" Height="480" Width="800" Background="#FFEFEFEF"
    WindowStartupLocation="CenterOwner" ResizeMode="CanResizeWithGrip" Icon="/WebsiteLoadTool;component/Images/system16.png">
    
    <Window.DataContext>
        <local:ConfigurationWindowViewModel/>
    </Window.DataContext>
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <TabControl Margin="4">
            <TabItem Header="Websites">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <DataGrid Margin="0,0,4,0" ItemsSource="{Binding Websites}" AutoGenerateColumns="False" SelectedItem="{Binding SelectedWebsite, Mode=TwoWay}">
                    	<DataGrid.Columns>
                    		<DataGridTextColumn Binding="{Binding ID}" IsReadOnly="True" Header="ID" Width="120"/>
                    		<DataGridTextColumn Binding="{Binding Name}" Header="Name" Width="0.2*"/>
                            <DataGridTextColumn Binding="{Binding URI}" Header="URI" Width="0.4*"/>
                            <DataGridTextColumn Binding="{Binding Username}" Header="Username" Width="0.2*"/>
                            <DataGridTextColumn Binding="{Binding Password}" Header="Password" Width="0.2*"/>
                            <DataGridTextColumn Binding="{Binding Domain}" Header="Domain" Width="0.2*"/>
                        </DataGrid.Columns>
                    </DataGrid>
                    <StackPanel Grid.Column="1">
                        <Button Width="130" Margin="0,0,0,4" Command="{Binding NewWebsiteCommand}">
                            <Grid Margin="0,4">
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Image Source="/WebsiteLoadTool;component/Images/add32.png" Stretch="None"/>
                                <TextBlock TextWrapping="Wrap" Text="New Website" Grid.Row="1"/>
                            </Grid>
                        </Button>
                        <Button Width="130" Margin="0,0,0,4" Command="{Binding DeleteWebsiteCommand}">
                            <Grid Margin="0,4">
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Image Source="/WebsiteLoadTool;component/Images/delete32.png" Stretch="None"/>
                                <TextBlock TextWrapping="Wrap" Text="Delete Website" Grid.Row="1"/>
                            </Grid>
                        </Button>
                    </StackPanel>
                </Grid>
            </TabItem>
            <TabItem Header="Generic">
                <StackPanel>
            		<GroupBox>
            			<GroupBox.Header>
            				<CheckBox Content="Use logfile" IsChecked="{Binding UseLog, Mode=TwoWay}"/>
            			</GroupBox.Header>
            			<Grid>
            				<Grid.ColumnDefinitions>
            					<ColumnDefinition Width="120"/>
            					<ColumnDefinition/>
            				</Grid.ColumnDefinitions>
            				<Grid.RowDefinitions>
            					<RowDefinition Height="Auto"/>
            					<RowDefinition/>
            				</Grid.RowDefinitions>
            				<Label Content="_Logfile Location" Margin="4,0" VerticalAlignment="Top" Target="{Binding ElementName=LogfileLoactionTextBox, Mode=OneWay}" IsEnabled="{Binding UseLog, Mode=TwoWay}"/>
            				<TextBox x:Name="LogfileLoactionTextBox" Grid.Column="1" Margin="4" TextWrapping="Wrap" Text="{Binding LogPath, Mode=TwoWay}" IsEnabled="{Binding UseLog}" VerticalAlignment="Center"/>
            			</Grid>
            		</GroupBox>
            		<GroupBox Header="Timer">
            			<Grid>
            				<Grid.RowDefinitions>
            					<RowDefinition Height="Auto"/>
            					<RowDefinition Height="Auto"/>
            				</Grid.RowDefinitions>
            				<Grid.ColumnDefinitions>
            					<ColumnDefinition Width="120"/>
            					<ColumnDefinition/>
            					<ColumnDefinition Width="Auto"/>
            				</Grid.ColumnDefinitions>
            				<CheckBox Content="Start timer when application starts" HorizontalAlignment="Left" Margin="8,4,0,4" IsChecked="{Binding StartWithApplication, Mode=TwoWay}" VerticalAlignment="Center" Grid.Row="1" Grid.ColumnSpan="3"/>
            				<Label Content="_Timer Interval" Margin="4,0" VerticalAlignment="Center" Target="{Binding ElementName=IntervalTextBox, Mode=OneWay}"/>
            				<TextBox x:Name="IntervalTextBox" Margin="4" TextWrapping="Wrap" Text="{Binding Interval, Mode=TwoWay}" Grid.Column="1" VerticalAlignment="Center"/>
            				<TextBlock Margin="4" TextWrapping="Wrap" d:LayoutOverrides="Height" Grid.Column="2" VerticalAlignment="Center"><Run Language="nl-nl" Text="seconds"/></TextBlock>
            			</Grid>
            		</GroupBox>
            		<GroupBox Header="Results">
            			<Grid>
            				<Grid.RowDefinitions>
            					<RowDefinition Height="Auto"/>
            					<RowDefinition Height="Auto"/>
            				</Grid.RowDefinitions>
            				<Grid.ColumnDefinitions>
            					<ColumnDefinition Width="120"/>
            					<ColumnDefinition/>
            				</Grid.ColumnDefinitions>
            				<Label Content="_Max Results Length" Margin="4,0" VerticalAlignment="Center" Target="{Binding ElementName=MaxResultLengthTextBox, Mode=OneWay}"/>
            				<TextBox x:Name="MaxResultLengthTextBox" Margin="4" TextWrapping="Wrap" Text="{Binding MaxResultLength, Mode=TwoWay}" Grid.Column="1" VerticalAlignment="Center"/>
            			</Grid>
            		</GroupBox>
            	</StackPanel>
            </TabItem>
        </TabControl>

        <StackPanel Margin="10,6,10,10" Orientation="Horizontal" Grid.Row="1" d:LayoutOverrides="Height" HorizontalAlignment="Right">
            <Button Content="OK" IsDefault="True" Width="120" Margin="10,0,0,0" Command="{Binding OKCommand}"/>

        </StackPanel>

    </Grid>
</Window>
